package main.java.indi.zyj.hot100;

import main.java.indi.zyj.hot100.base.ListNode;

public class _26_swapPairs {
    public ListNode swapPairs(ListNode head) {

        ListNode top = new ListNode(-1);
        top.next = head;
        ListNode p = top;

        while (p.next != null && p.next.next != null) {

            ListNode p1 = p.next;
            ListNode p2 = p.next.next;

            p.next = p2;
            p1.next = p2.next;
            p2.next = p1;
            p = p1;

        }

        return top.next;



    }
}
